﻿namespace CommonData.Model.Core
{
    using System;

    public sealed class ColumnAttribute : Attribute
    {
        private bool autoIncrement;
        private bool canNull;
        private CommonData.Model.Core.DataType dataType;
        private object defaultValue;
        private string foreignTabName;
        private string information;
        private bool isForeignKey;
        private bool isPrimaryKey;
        private bool isUnique;
        private int length;
        private string name;
        private string regularExpress;
        private string tableName;

        public ColumnAttribute()
        {
            this.isPrimaryKey = false;
            this.autoIncrement = false;
            this.isForeignKey = false;
        }

        public ColumnAttribute(string name, CommonData.Model.Core.DataType dataType, bool isPrimaryKey, bool autoIncrement, bool isUnique, bool isForeignKey, string foreignTabName)
        {
            this.isPrimaryKey = false;
            this.autoIncrement = false;
            this.isForeignKey = false;
            this.name = name;
            this.dataType = dataType;
            this.isPrimaryKey = isPrimaryKey;
            this.autoIncrement = autoIncrement;
            this.isUnique = isUnique;
            this.isForeignKey = isForeignKey;
            this.foreignTabName = foreignTabName;
        }

        public ColumnAttribute(string name, string tableName, CommonData.Model.Core.DataType dataType, int length, bool canNull, object defaultValue, bool isPrimaryKey, bool autoIncrement, bool isUnique, string regularExpress, bool isForeignKey, string foreignTabName, string information)
        {
            this.isPrimaryKey = false;
            this.autoIncrement = false;
            this.isForeignKey = false;
            this.name = name;
            this.tableName = tableName;
            this.dataType = dataType;
            this.length = length;
            this.canNull = canNull;
            this.defaultValue = defaultValue;
            this.isPrimaryKey = isPrimaryKey;
            this.autoIncrement = autoIncrement;
            this.regularExpress = regularExpress;
            this.isForeignKey = isForeignKey;
            this.ForeignTabName = foreignTabName;
            this.information = information;
            this.isUnique = isUnique;
        }

        public bool AutoIncrement
        {
            get
            {
                return this.autoIncrement;
            }
            set
            {
                this.autoIncrement = value;
            }
        }

        public bool CanNull
        {
            get
            {
                return this.canNull;
            }
            set
            {
                this.canNull = value;
            }
        }

        public CommonData.Model.Core.DataType DataType
        {
            get
            {
                return this.dataType;
            }
            set
            {
                this.dataType = value;
            }
        }

        public object DefaultValue
        {
            get
            {
                return this.defaultValue;
            }
            set
            {
                this.defaultValue = value;
            }
        }

        public string ForeignTabName
        {
            get
            {
                return this.foreignTabName;
            }
            set
            {
                this.foreignTabName = value;
            }
        }

        public string Information
        {
            get
            {
                return this.information;
            }
            set
            {
                this.information = value;
            }
        }

        public bool IsForeignKey
        {
            get
            {
                return this.isForeignKey;
            }
            set
            {
                this.isForeignKey = value;
            }
        }

        public bool IsPrimaryKey
        {
            get
            {
                return this.isPrimaryKey;
            }
            set
            {
                this.isPrimaryKey = value;
            }
        }

        public bool IsUnique
        {
            get
            {
                return this.isUnique;
            }
            set
            {
                this.isUnique = value;
            }
        }

        public int Length
        {
            get
            {
                return this.length;
            }
            set
            {
                this.length = value;
            }
        }

        public string Name
        {
            get
            {
                return this.name;
            }
            set
            {
                this.name = value;
            }
        }

        public string RegularExpress
        {
            get
            {
                return this.regularExpress;
            }
            set
            {
                this.regularExpress = value;
            }
        }

        public string TableName
        {
            get
            {
                return this.tableName;
            }
            set
            {
                this.tableName = value;
            }
        }
    }
}

